package com.direct.service;

import com.direct.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author caixiaofeng
 * @company xxx公司科技有限公司
 * @create 2020-04-21 21:53
 */
@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory<DeptClientService> {
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept queryById(Long deptno) {
                return new Dept()
                        .setDeptno(-1L)
                        .setDname("当前服务已关闭")
                        .setDb_source(null);
            }

            @Override
            public List<Dept> queryAll() {
                return null;
            }

            @Override
            public void addDept(Dept dept) {

            }
        };
    }
}
